class Utils {
  static String formatNumber(int num) {
    if (num < 1000) {
      return '$num';
    }

    var divisor;
    var suffix;

    if (num >= 1000 && num <= 9999) {
      divisor = 1000.0;
      suffix = 'k';
    } else if (num >= 10000 && num <= 9999999) {
      divisor = 10000.0;
      suffix = 'w';
    } else {
      divisor = 10000000.0;
      suffix = 'kw';
    }

    double formattedCount = num.toDouble() / divisor;
    double roundedCount = (formattedCount * 10).floorToDouble() / 10;

    if (roundedCount % 1 != 0) {
      return '${roundedCount.toStringAsFixed(1)}$suffix';
    } else {
      return '${roundedCount.toInt()}$suffix';
    }
  }
}